﻿using AttributeRouting.Web.Http;
//using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Water.Model;

namespace Water.RestService.Controllers
{
    public class BigValveOperateController : ApiController
    {

        private BigValveOperateQuery bfoq;
        private BigValveOperate bvo;

        [POST("GetBigValveOperates")]
        public IList<BigValveOperateQuery> PostGetBigValveOperates(BigValveOperateCon bvoc)
        {
            bfoq = new BigValveOperateQuery();            
            return bfoq.GetBigValveOperates(bvoc);
        }
        /*
        [POST("GetBigValveOperatesCount")]
        public int PostGetBigValveOperatesCount(BigValveOperate info)
        {
            var where = BigValveOperateWhere(info);
            int count = rep.LoadCount(where);
            return count;
        }
        */

        [POST("AddBigValveOperate")]
        public bool PostAddBigValveOperate(BigValveOperate info)
        {
            info.MRNO = BuilderMrno.GetMrnoFortbl("Tbt_BigValveOperate");
            bvo = new BigValveOperate();
            bool result = bvo.AddBigValveOperate(info) > 0 ? true : false;
            return result;
        }

        [POST("EditBigValveOperate")]
        public bool PostEditBigValveOperate(BigValveOperate info)
        {
            bvo = new BigValveOperate();
            bool result = bvo.UpdateBigValveOperate(info) > 0 ? true : false;
            return result;
        }
        /*
        [GET("DeleteBigValveOperate/{code}")]
        public bool GetDeleteBigValveOperate(string code)
        {
            bool result = rep.Delete(code);
            return result;
        }
        */
        [GET("GetBigValveOperate/{epcno}")]
        public BigValveOperate GetBigValveOperate(string epcno)
        {
            bvo = new BigValveOperate();
            var result = bvo.GetBigValveOperate(epcno);
            return result;
        }
        
    }
}
